/**
 * Created by Administrator on 2017/4/25.
 */

let mysqlUserPlayFootDao = require('../daos/MysqlUserPlayFootDao');

module.exports = {
    findMovieInfoByOpenid: function (req, res, next) {

        let param = {};
        param.openId = req.body.openId ? req.body.openId : '';
        param.lastIndex = req.body.lastIndex ? req.body.lastIndex : 0;

        mysqlUserPlayFootDao.findMovieInfoByOpenid(param, function (data) {
            if (data.isSuccess) {
                let midData = [];
                data.result.forEach(function (v, i) {
                    midData.push({
                        mid: v.mid,
                        endtime: v.endtime
                    })
                });
                res.json({
                    status: 'succes',
                    data: midData
                });
            } else {
                res.json({
                    status: 'fail',
                    data: ''
                });
            }
        });
    },
    findCinemaInfoByOpenid: function (req, res, next) {
        let param = {};
        param.openId = req.body.openId ? req.body.openId : '';
        param.lastIndex = req.body.lastIndex ? req.body.lastIndex : 0;
        mysqlUserPlayFootDao.findCinemaInfoByOpenid(param,function(data){
            if(data.isSuccess){
                let midData = [];
                data.result.forEach(function (v, i) {
                    midData.push({
                        cid: v.cid,
                        endtime: v.endtime
                    })
                });
                res.json({
                    status: 'succes',
                    data: midData
                });
            }else{
                res.json({
                    status: 'fail',
                    data: ''
                });
            }
        });
    }
};